|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPER.rover.ScanAction
ScanAction.java uses the IR rangefinder to search for "rocks" near the rover. If multiple rocks are found, preference is given to the one closest to the front of the rover.
Field Summary | |
static int |
DISTANCE_THRESHOLD
An object needs to be at least this close to be called a rock. |
static int |
IR_HEIGHT
The height of the IR range finger, in cm. |
static int |
MAX_ROCK_WIDTH
A rock can be at most this wide, otherwise I call it a wall. |
Constructor Summary | |
ScanAction()
Creates a new instance of ScanAction with default scan parameters of tilt -10, minimum pan angle -135, maximum pan angle 135, and step 5. |
|
ScanAction(int tilt,
int minPan,
int maxPan,
int step)
Scans the area around where the rover is. |
Method Summary | |
int |
closestReading()
|
boolean |
doAction(Rover r)
Tries to start the action. |
int[] |
getClosestPoint()
Finds and returns the closest point from the recent scan |
long |
getImageUpdateTime()
Lets you know when the last image was taken by this action. |
int |
getMaxRockAngle()
|
int |
getMinRockAngle()
|
java.awt.image.BufferedImage |
getRecentImage()
Returns the most recent image taken by this Action. |
int |
getReturnValue()
The return value of the Action. |
int |
getRockAngle()
Getter for property rockAngle. |
int |
getRockDist()
Getter for property rockDist. |
java.lang.String |
getShortSummary()
Provides a shortened version of the summary returned by getSummary. |
java.lang.String |
getSummary()
Provides a textual explanation of the Action, such as "turn 90 degrees" |
int |
getTime()
How long the action will take, in milliseconds. |
int |
getTimeRemaining()
How much time until the action finishes (in milliseconds), if it has already started. |
boolean |
hasDetectedWall()
Returns whether or not a wall was detected. |
boolean |
hasFoundRock()
Getter for property foundRock. |
boolean |
isCompleted()
Whether the action has completed. |
boolean |
isSuccess()
Whether the action completed successfully. |
void |
kill()
this action can't currently be killed |
int |
moveFromRock(Rover rov,
int turnAngle)
If the rover is near a rock and will turn into it, this function should make it so that the rover won't hit the rock |
void |
setBorderRocks(boolean allow)
|
static int |
translateScan(int scan)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int DISTANCE_THRESHOLD
public static final int MAX_ROCK_WIDTH
public static final int IR_HEIGHT
Constructor Detail |
public ScanAction()
public ScanAction(int tilt, int minPan, int maxPan, int step)
tilt
- The tilt at which the scan is done.minPan
- The pan angle at which the scan startsmaxPan
- The pan angle at which the scan ends.step
- The angle difference between successive scan points.Method Detail |
public boolean doAction(Rover r)
Action
doAction
in interface Action
public int getReturnValue()
Action
getReturnValue
in interface Action
RoverState
,
ActionConstants
public java.lang.String getShortSummary()
Action
getShortSummary
in interface Action
public java.lang.String getSummary()
Action
getSummary
in interface Action
public int getTime()
Action
getTime
in interface Action
public int getTimeRemaining()
Action
getTimeRemaining
in interface Action
public boolean isCompleted()
Action
isCompleted
in interface Action
public boolean isSuccess()
Action
isSuccess
in interface Action
public void kill()
kill
in interface Action
public boolean hasFoundRock()
public int getRockAngle()
public int getRockDist()
public int getMinRockAngle()
public int getMaxRockAngle()
public int closestReading()
public int[] getClosestPoint()
public static int translateScan(int scan)
public void setBorderRocks(boolean allow)
public boolean hasDetectedWall()
public int moveFromRock(Rover rov, int turnAngle)
rov
- An active instantion of a RoverturnAngle
- the angle that the rover is about to turnpublic long getImageUpdateTime()
Action
getImageUpdateTime
in interface Action
public java.awt.image.BufferedImage getRecentImage()
Action
getRecentImage
in interface Action
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |